// import { STORAGE_KEY } from './config'
import { cookieToJson } from '../utils/index'

export default {
  async fetch({app, store, params}) {

  },
  nuxtServerInit({commit, state}, {req}) {
    let cookie = req.headers.cookie
    if(cookie){
      cookie = cookie.replace(/\s+/g,"");
    }
    console.log("cookie=")
    console.log(cookie)
    // 将cookie转成json对象
    let token = cookieToJson(cookie).token
    commit('setToken', token)//保存vuex

    let language = cookieToJson(cookie).language
    commit('SET_LANG', language)
    console.log('language=' + language)
  }
}

